#ifndef TICKSHEET_H
#define TICKSHEET_H

#include <QObject>
#include <QTimer>

#include "recordedtime.h"

class Ticksheet : public QObject
{

    Q_OBJECT

public:

    Ticksheet(QObject* parent, int syncHours, int syncMins, int syncSecs);
    virtual ~Ticksheet();

    RecordedTime*        recordTime(const QString& note);
    QString              elapsedTimeString();
    bool                 isRunning();
    void                 stop();
    void                 restart();
    void                 saveFile(const QString& fileName);
    QList<RecordedTime*> shownRecordedTimes();
    void                 toggleLastTimeWarning();

signals:
    void                 timeChanged(const QString&);
    void                 timeRecorded();

private slots:
    void                 on_timer_timeout();

private:

    int                  mRecordCount;
    QList<RecordedTime*> mRecordedTimes;
    RecordedTime*        mLastRecordedTime;

    QTime*               mElapsedTime;

    QTime                mStartTime;
    QDate                mStartDate;

    QTimer*              mTimer;
    bool                 mIsRunning;
};

#endif // TICKSHEET_H
